var express = require('express');
var url = require('url');
var router = express.Router();

var text = ['0001'];
/* GET home page. */
router.get('/', function(req, res, next) {
	var url_info = require('url').parse(req.url, true);
	var name1 = url_info.query.chat;
	if(name1){
		text.push(name1);
	}
  	res.send(text)
});

router.get('/ck', function(req, res, next) {
  res.render('chat');
});

router.get('/delete', function(req, res, next) {
	var url_info = require('url').parse(req.url, true);
	var name1 = url_info.query.password;
	if(name1&&name1=='wangjiawei'){
		text = [];
		res.send('成功')
	}
  	res.send('失败，口令错误')
});

module.exports = router;
